package com.foreveross.push.demo;

import org.apache.cordova.CordovaWebView;
import android.content.Context;
import android.util.Log;
import android.webkit.JavascriptInterface;

/**
 * Created by zhouzhineng on 14-8-19.
 * 这个类主要为
 */
public class NotificationPushMsg {
    public final static String TAG = "NotificationPushMsg";
    private Context mContext;
    CordovaWebView mCordovaWebView;

    public NotificationPushMsg(Context context,CordovaWebView cordovaWebView) {
        mContext = context;
        mCordovaWebView = cordovaWebView;
    }

    /**
     * 提供给js调用的
     * @param msg
     * @param callback
     */

    public void callByJsMsgHandler(String msg,String jsMsgHandler) {
        Log.d(TAG,"callMessageHandle 被js掉用了...");
        mCordovaWebView.sendJavascript(jsMsgHandler);
    }

    public void callByNative() {
        mCordovaWebView.sendJavascript("window.plugins.pushNotification.callByNt(" + "\'what the fuck!\'" + ");");
    }

}
